package com;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
import com.alibaba.nacos.spring.context.annotation.config.EnableNacosConfig;

import de.codecentric.boot.admin.server.config.EnableAdminServer;

@EnableAdminServer
@EnableNacosConfig
@SpringBootApplication(exclude = { DruidDataSourceAutoConfigure.class })
public class AdminServerApplication {
    public static void main(String[] args) {
        // 获取 Spring Boot 上下文
        ConfigurableApplicationContext ctx = SpringApplication.run(AdminServerApplication.class, args);
        // ctx.getEnvironment(); // 获取 边境变量
        System.out.println("===========================================");
        // 获取字符串
        System.out.println("String: " + (ctx.getEnvironment().getProperty("com.demo.name") + 1111));
        // 获取整数
        System.out.println("Interger:   " + (ctx.getEnvironment().getProperty("server.port", Integer.class) + 1111));
        System.out.println("String: " + (ctx.getEnvironment().getProperty("hello.myself")));
        System.out.println("String: " + (ctx.getEnvironment().getProperty("hello.myself2")));
    }
}